﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Collections;
using System.Configuration;
using SnailGame.Utility.DataAccess;
using Com.Crc.PoJo.Model.WorkForm;
namespace Com.Crc.WFManage.DAL.WorkFormManage
{
    public class WFWLANManageDAL
    {
        DataBroker broker = new DataBroker();

        public Boolean addWFWLAN(WFWLAN data)
        {

            string strSql = @" INSERT INTO WF_WLAN(N_TYPE,N_IN_TYPE,N_STATION_ID,S_ACCOUNT,S_DK,S_NAME,S_TEL,S_ADDRESS_TYPE,S_ADDRESS,N_PORT,N_IN_AREA,S_ORG_ACCOUNT,S_STATE,N_OPER_ID,D_DATE,S_BAK,S_TO_UPDATE) VALUES (" + data.N_TYPE + "," + data.N_IN_TYPE + "," + data.N_STATION_ID + "," + "'" + data.S_ACCOUNT + "'" + "," + "'" + data.S_DK + "'" + "," + "'" + data.S_NAME + "'" + "," + "'" + data.S_TEL + "'" + "," + "'" + data.S_ADDRESS_TYPE + "'" + "," + "'" + data.S_ADDRESS + "'" + "," + data.N_PORT + "," + data.N_IN_AREA + "," + "'" + data.S_ORG_ACCOUNT + "'" + "," + "'" + data.S_STATE + "'" + "," + data.N_OPER_ID + ",GETDATE(),'" + data.S_BAK + "','" + data.S_TO_UPDATE + "')";

            return broker.ExecuteForOleDB(strSql, ConfigurationManager.ConnectionStrings["CRCAppConn"].ToString());

        }




        public DataTable queryBy(int wfType, string account)
        {

            string strsql = "select * from dbo.WF_WLAN a where  1=1 ";
            if(wfType>0)
            {
                strsql=strsql+" and a.n_type="+wfType;
            }
            if (account != null && account.Trim().Length>0)
            {
                strsql = strsql + " and a.S_ACCOUNT like '%" + account+"%'";
            }

            return broker.ExecuteQueryForOleDB(strsql, ConfigurationManager.ConnectionStrings["CRCAppConn"].ToString());

        }
    }
}
